<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:environment:add">
				<i class="fa fa-plus"></i> 添加
			</a>
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:environment:edit">
	            <i class="fa fa-edit"></i> 修改
	        </a>
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:environment:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
			<a class="btn btn-success btn-edit disabled" onclick="$.operate.copy()" shiro:hasPermission="system:environment:copy">
				<i class="fa fa-plus"></i> 复制
			</a>			
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:src="@{/ajax/libs/select/select2.js}"></script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:environment:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:environment:remove')}]];
        var copyFlag = [[${@permission.hasPermi('system:environment:copy')}]];
		var datas = [[${@dict.getType('valid')}]];
        var prefix = ctx + "system/environment";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                copyUrl: prefix + "/copy/{id}",
				queryParams: queryParams,
                modalName: "版本环境配置",
				search: false,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'lgcPk', 
					title : '逻辑主键' 
				},
				{
					field : 'prjId', 
					title : '项目编号' 
				},
				{
					field : 'prjNm', 
					title : '项目名称' 
				},
				{
					field : 'dvlpstrmId', 
					title : '开发流编号' 
				},
				{
					field : 'dvlpstrmNm', 
					title : '开发流名称' 
				},
				{
					field : 'vrsnDt', 
					title : '版本日期' 
				},
				{
					field : 'relsUit', 
					title : '部署单元' 
				},
				{
					field : 'vrsnIp', 
					title : '版本机IP' 
				},
				{
					field : 'serstrPort', 
					title : '服务启动端口' 
				},
				{
					field : 'tagvrsnPag', 
					title : '目标版本包' 
				},
				{
					field : 'tagvrsnPagRte', 
					title : '目标版本包路径' 
				},
				{
					field : 'valid', 
					title : '是否在自动版本中生效(0:生效 1:未生效)',
					formatter: function(value, row, index) {
						return $.table.selectDictLabel(datas, value);
					}
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.lgcPk + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.lgcPk + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-success btn-xs ' + copyFlag + '" href="#" onclick="$.operate.copy(\'' + row.lgcPk + '\')"><i class="fa fa-plus"></i>复制</a> ');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        
		function queryParams(params) {
			return {
				dictType:       $("#dictType").val(),
				pageSize:       params.limit,
    			pageNum:        params.offset / params.limit + 1,
    			searchValue:    params.search,
    			orderByColumn:  params.sort,
    			isAsc:          params.order
			};
		}
    </script>
</body>
</html>